'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1514183946804_9457';

  // add your config here
  // config.middleware = [ 'auth', 'isAdmin' ];
  // auth middleware config, ignore index，login and upload
  config.auth = {
    enable: true,
    ignore: /^\/iface\/?(login|upload)?$/,
  };
  // operator login password secret key
  config.operator_secret = 'shoushoushoushou'; // md5('wushoujia')

  config.token_secret = 'iface_token';

  config.security = {
    csrf: {
      enable: false,
    },
  };

  // 文件上传大小限制
  config.multipart = {
    fileSize: '5mb',
    whitelist: [
      '.jpg', '.jpeg', // image/jpeg
      '.png', // image/png, image/x-png
      '.gif', // image/gif
      '.bmp', // image/bmp
      '.wbmp', // image/vnd.wap.wbmp
      '.xlsx',
    ],
  };

  // 跨域设置
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  };

  // 腾讯云
  config.qcloud = {
    secretId: 'AKIDl5DE8snhBec5Flw9OOrqZnY8YucZgQwi',
    secretKey: 'actOZd28kOxF07z7cg2EFGXrp4t74a9N',
    bucket: 'static-10061617',
    region: 'cn-east',
    origin: 'http://static.namifunds.com/',
  };

  // token 过期天数
  config.token_expire_days = 1;

  // 状态码
  config.code = {
    SUCCESS: 0,
    ERROR: -1,
    OPERATOR_EXIST: 100, // 操作员存在
    NOT_AUTHORIZE: 10000, // 未登录
    NOT_ALLOWED: 10001, // 权限不足
  };

  // mta
  config.mta = {
    appId: 500430688,
    secretKey: 'b421c01dc754e1cbcb6d5e835096588c',
    ctrCustomUrl: 'http://mta.qq.com/h5/api/ctr_custom', // 自定义事件
    ctrPageUrl: 'http://mta.qq.com/h5/api/ctr_page', // 页面排行
  };
  return config;
};
